// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/access/api/RecordDashboardApi'

import TypeClass from '@api/access/model/AccessTypePieReq'
import RankClass from '@api/access/model/AccessUserRankReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 类型 —————————————————————————————— //

  async getType(param, TIP = '查询通行统计') {
    const DTO = CORE.grpcDTO(TypeClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'accessTypePie', DTO)
    return resp.pieList || []
  },

  // —————————————————————————————— 排名 —————————————————————————————— //

  async getRank(param, TIP = '查询累计出入') {
    const DTO = CORE.grpcDTO(RankClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'accessUserRank', DTO)
    return resp.list || []
  },
}
